package mhcs.client;

import com.allen_sauer.gwt.voices.client.Sound;
import com.allen_sauer.gwt.voices.client.SoundController;

public class SoundOutput implements MyListener{

	SoundController soundController0;
	SoundController soundController1;
	SoundController soundController2;
	SoundController soundController3;
	SoundController soundController4;
	SoundController soundController5;
	SoundController soundController6;
	SoundController soundController7;
	SoundController soundController8;
    Sound sound0;
    Sound sound1;
    Sound sound2;
    Sound sound3;
    Sound sound4;
    Sound sound5;
    Sound sound6;
    Sound sound7;
    Sound sound8;
    
	SoundOutput(){
		MHCS.dataSet.addListener(this);
	
	
		
		soundController0 = new SoundController();
		soundController1 = new SoundController();
		soundController2 = new SoundController();
		soundController3 = new SoundController();
		soundController4 = new SoundController();
		soundController5 = new SoundController();
		soundController6 = new SoundController();
		soundController7 = new SoundController();
		soundController8 = new SoundController();
		
//		sound0 = soundController0.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
//		        "sounds/ModuleAdded.mp3", false, true);
//		sound1 = soundController1.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
//		        "sounds/ModuleDeleted.mp3", false, true);
//		sound2 = soundController2.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
//		        "sounds/ModuleEdited.mp3", false, true);
//		sound3 = soundController3.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
//		        "sounds/LoggingIn.mp3", false, true);
//		sound4 = soundController4.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
//		        "sounds/LoggingOut.mp3", false, true);
//		
//		sound0.setVolume(0);
//		sound1.setVolume(0);
//		sound2.setVolume(0);
//		sound3.setVolume(0);
//		sound4.setVolume(0);
	}
	
	public void playSound0(){
		sound0 = soundController0.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/ModuleAdded.mp3", false, true);
		//sound0.setVolume(75);
		//sound0.play();
	}
	
	public void playSound1(){
		sound1 = soundController1.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/ModuleDeleted.mp3", false, true);
		//sound1.setVolume(75);
		//sound1.play();
	}
	
	public void playSound2(){
		sound2 = soundController2.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/ModuleEdited.mp3", false, true);
		//sound2.setVolume(75);
		//sound2.play();
	}
	
	public void playSound3(){
		sound3 = soundController3.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/LoggingIn.mp3", false, true);
		//sound3.setVolume(75);
		//sound3.play();
	}
	
	public void playSound4(){
		sound4 = soundController4.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/LoggingOut.mp3", false, true);
		//sound4.setVolume(75);
		//sound4.play();
	}
	
	public void playSound5(){
		sound5 = soundController5.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/10Days.mp3", false, true);
		//sound4.setVolume(75);
		//sound4.play();
	}
	
	public void playSound6(){
		sound6 = soundController6.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/ConfigSelected.mp3", false, true);
		//sound4.setVolume(75);
		//sound4.play();
	}
	
	public void playSound7(){
		sound7 = soundController7.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/Saved.mp3", false, true);
		//sound4.setVolume(75);
		//sound4.play();
	}
	
	public void playSound8(){
		sound8 = soundController8.createSound(Sound.MIME_TYPE_AUDIO_BASIC,
		        "sounds/Load.mp3", false, true);
		//sound4.setVolume(75);
		//sound4.play();
	}
	

	@Override
	public void actionPerformed(String action, Module module) {
		
//		int caseNumber = -1;
//		
//		if(action.equals("add")) caseNumber = 0;
//		else if(action.equals("remove")) caseNumber = 1;
//		else if(action.equals("edit")) caseNumber = 2;
//		else if(action.equals("login")) caseNumber = 3;
//		else if(action.equals("logout")) caseNumber = 4;
//		else caseNumber = -1;
//		
//		switch(caseNumber){ 
//		case 0:{
//			sound0.play();
//		}
//		case 1:{
//			sound1.play();
//		}
//		case 2:{
//			sound2.play();
//		}
//		case 3:{
//			sound3.play();
//		}
//		case 4:{
//			sound4.play();
//		}
//		}
		
	}
		
}
